<?php
// get core
foreach(scandir("core/base/") as $file) {
  if(!strpos($file,".") == 0 && !is_dir($file)) {
    include "core/base/$file";
  }
}
// get plugins
foreach(scandir("extend/") as $file) {
  if(strpos($file,".") !== 0) {
    if(is_dir("extend/$file")) {
      include "extend/$file/$file.php";
    } else {
      include "extend/$file";
    }
  }
}
// for timer, etc
do_hooks('absolute_beginning');
// connect to database
$db = new Database('database.sqlite');
// load stuff
include_dir('core/helpers');
include_dir('core/models');
// decide which controller, action, page
include 'core/routes.php';
// this will be included from the wrapper.php
if(!empty($_GET['format'])) { // ?format= parameter overrides config setting
  $skin = $_GET['format'];
}
$main_content = "skins/$skin/$controller/$action.php";
// load, initialize the controller
include "core/controllers/$controller-controller.php";
eval("\$main_controller = new $controller"."_controller(\$ident);");
eval("\$main_controller -> $action();");
// get the show on the road
include "skins/$skin/wrapper.php";
// finish up
do_hooks('absolute_end');
?>